package com.jiangchuang.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jiangchuang.domain.entity.FanUser;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author jmk
 * @date 2022-12-07 15:23
 */
public interface FanUserMapper extends BaseMapper<FanUser> {
//    @Select("select fuw.fid,fw.name,fw.owner_id,uw.nickname,uw.portrait_url,fuw.uid from fan_user_wechat fuw left join fan_wechat fw on fw.id=fuw.fid left join user_wechat uw on uw.id=fw.owner_id where uid=#{uid}")
//    List<GetFansByUidRes> getFansByUid(int uid);

//    @Select("select fu.id, f.id fid,f.name,f.creator_id,u.id uid,u.nickname,u.portrait_url from fan_user fu left join fan f on f.id=fu.fid left join user u on u.id=fu.uid where fid=#{fid}")
//    List<GetFanUsersRes> getFanUsers(int fid);

    @Select("select u.id uid, count(*) as count from user u left join fan_user fu on fu.uid=u.id GROUP BY u.id HAVING count>1 ")
    List<Integer> getClearFan();

}
